// sub_minsheng_sjts/sjts_wander/sjts_wander.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    allChecked: false,
    checkState: false,
    searchValue: '',
    result: [],
    listData: [{ id: '1', checkState: false }, { id: '2', checkState: false }, { id: '3', checkState: false }, { id: '4', checkState: false }, { id: '5', checkState: false }, { id: '6', checkState: false }, { id: '7', checkState: false }, { id: '8', checkState: false }]
  },
  goWHY() {
    wx.navigateTo({
      url: "/sub_minsheng_sjts/sjts_batch_why/sjts_batch_why",
    })
  },
  goManager() {
    wx.navigateTo({
      url: "/sub_minsheng_sjts/sjts_selectManager/sjts_selectManager",
    })
  },
  AllonChange(event) {
    console.log(event, 'eee')
    this.data.result = []
    if (event.detail == false) {
      this.data.listData.forEach(element => {

      });
    } else {
      this.data.listData.forEach(element => {
        this.data.result.push(element.id)
      });
    }

    this.setData({
      allChecked: event.detail,
      result: this.data.result
    });
  },
  onChange(event) {
    console.log(event)


    let allstate = true
    for (let i in this.data.listData) {
      if (event.detail.includes(this.data.listData[i].id) == false) {
        allstate = false

      }
    }
    this.setData({
      result: event.detail,
      allChecked: allstate
    });
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})